// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.

import './config'
import Vue from 'vue'
import App from './App'
console.log(process.env.url_api)
import router from './router'

import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

Vue.use(ElementUI);

Vue.config.productionTip = false;

//vuex
import store from './store/index'
Vue.prototype.$store = store;

//全局样式
import './assets/css/lib/reset.css';
import './assets/css/lib/dialog.css';
import './assets/css/lib/media.css';

//全局syheader
import syHeader from '@/components/public/syheader.vue';
Vue.component('syHeader', syHeader);
//全局header
import Header from '@/components/public/header.vue';
Vue.component('pubHeader', Header);

//全局左侧header
import leftHeader from '@/components/public/leftHeader.vue';
Vue.component('leftHeader', leftHeader);


//全局二级导航
import secondNav from '@/components/public/secondNav.vue';
Vue.component('secondNav', secondNav);

//全局三级导航
import grHeader from '@/components/public/grHeader.vue';
Vue.component('grHeader', grHeader);
//无数据
import NoData from '@/components/NoData.vue';
Vue.component('NoData', NoData);


import apiConfig from '../config/api.config.js'
Vue.prototype.$url = apiConfig;

import api from './http/api.js'
Vue.prototype.$api = api

import echarts from 'echarts'
Vue.prototype.$echarts = echarts

import ajax from './http/axios.js'
Vue.prototype.$ajax = ajax

import htmlToPdf from './utils/htmlToPdf'
// 使用Vue.use()方法就会调用工具方法中的install方法
Vue.use(htmlToPdf)

import md5 from 'js-md5';
Vue.prototype.$md5 = md5;


import directives from './directives/index'
Vue.use(directives)




// 路由发生变化修改页面title
router.beforeEach((to, from, next) => {
  if (to.meta.title) {
    document.title = to.meta.title;
  }
  next();
});

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  beforeCreate() {
    Vue.prototype.$bus = this;
  },
  components: {
    App
  },
  template: '<App/>'
})
